<template>
  <div class="bottom_wrap">
    <ul class="bottom_nav">
      <li>商品详情</li>
      <li>商品评价</li>
    </ul>
    <div class="info">
      <div class="big_img">
        <ul class="attr_list">
          <li v-for="(item, index) in details.properties" :key="index">
            <span>{{ item.name }}：</span> <span>{{ item.value }}</span>
          </li>
        </ul>
        <img
          v-for="(imgItem, index) in details.pictures"
          :key="index"
          :src="imgItem"
          alt=""
        />
      </div>

      <div class="oneday">
        <div class="twentyfour">
          <h1>24小时热榜</h1>
          <div class="four_list">
            <div class="list_one" v-for="item in fourList" :key="item.id">
              <img :src="item.picture" alt="" />
              <div>{{ item.name }}</div>
              <p>{{ item.desc }}</p>
              <div class="price">{{ item.price }}</div>
            </div>
          </div>
        </div>
        <div class="twentyfour">
          <h1>周热销榜</h1>
          <div class="four_list">
            <div class="list_one" v-for="item in weekList" :key="item.id">
              <img :src="item.picture" alt="" />
              <div>{{ item.name }}</div>
              <p>{{ item.desc }}</p>
              <div class="price">{{ item.price }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { _getHotList } from '../../../api/detail'
export default {
  props: ['details'],
  data () {
    return {
      fourList: [], //24小时热榜数据
      weekList: [] //周榜数据
    }
  },
  created () {
    this.getHot(1)
    this.getHot(2)
  },
  methods: {
    async getHot (type) {
      // 获取热榜接口
      var res = await _getHotList({
        id: this.$route.query.id,
        limit: 4,
        type: 1
      })
      if (type == 1) {
        this.fourList = res.data.result
      } else if (type == 2) {
        this.weekList = res.data.result
      }
    }
  }
}
</script>
<style lang="less" scoped>
.bottom_wrap {
  width: 1240px;
  margin: 20px auto;
  .bottom_nav {
    width: 940px;
    display: flex;
    border-bottom: 1px solid #e5e5e5;
    li {
      width: 150px;
      height: 68px;
      line-height: 68px;
    }
  }
  .info {
    width: 1240px;
    display: flex;
    justify-content: space-between;
    .big_img {
      width: 930px;
      .attr_list {
        width: 1000px;
        margin: 10px auto;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        li {
          width: 45%;
          height: 50;
        }
      }
    }
    .oneday {
      width: 280px;
      height: 200px;
    }
  }
}
.twentyfour {
  margin-top: 20px;
  h1 {
    height: 80px;
    background: #e26237;
    color: white;
    text-align: center;
    line-height: 80px;
  }
  .four_list {
    width: 280px;
    .list_one {
      width: 280px;
      height: 339px;
      border: 1px solid red;
      text-align: center;
      margin-top: 10px;
      img {
        width: 200px;
        height: 200px;
      }
      p {
        margin: 15px auto;
      }
      .price {
        color: red;
      }
    }
  }
}
</style>
